package demo04;

import java.net.MalformedURLException;
import java.net.URL;

public class URLdemo01 {

    public static void main(String[] args) throws MalformedURLException {
//        URL url = new URL("http://localhost:8080/helloworld/index.jsp?username=lihuaqi&password=123");
        URL url = new URL("https://www.bilibili.com/video/BV1LJ411z7vY?t=165&p=12");
        System.out.println(url.getProtocol());//获取URL协议
        System.out.println(url.getHost());//主机
        System.out.println(url.getPort());//端口
        System.out.println(url.getPath());//文件
        System.out.println(url.getFile());//文件全路径
        System.out.println(url.getQuery());//参数


    }
}
